package swb.api.com.repository.dto;

import lombok.Data;
import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 提现账户实体类
 * 用于存储用户的各种提现账户信息，包括微信、支付宝等账户类型
 */
@Entity
@Table(name = "withdraw_accounts", indexes = {
        @Index(name = "idx_user_id", columnList = "user_id"),
        @Index(name = "idx_account_type", columnList = "account_type"),
        @Index(name = "idx_user_account_type", columnList = "user_id, account_type"),
        @Index(name = "idx_status", columnList = "status"),
        @Index(name = "idx_is_default", columnList = "is_default"),
        @Index(name = "idx_created_at", columnList = "created_at")
})
@Data
public class WithdrawAccount {
    /**
     * 账户ID，主键，自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户ID，关联用户表
     */
    @Column(name = "user_id")
    private Long userId;

    /**
     * 账户类型
     * 1:微信, 2:支付宝
     */
    @Column(name = "account_type")
    private Integer accountType; // 1:微信, 2:支付宝

    /**
     * 真实姓名
     */
    @Column(name = "real_name")
    private String realName;

    /**
     * 账户号码（微信openid或支付宝账号等）
     */
    @Column(name = "account_no")
    private String accountNo;

    /**
     * 是否默认账户
     * 0:否, 1:是
     */
    @Column(name = "is_default")
    private Integer isDefault = 0;

    /**
     * 账户状态
     * 1:正常, 0:禁用
     */
    private Integer status = 1;

    /**
     * 创建时间
     */
    @Column(name = "created_at")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @Column(name = "updated_at")
    private LocalDateTime updatedAt;
}
